
class DrawHit
attr_reader :x, :y
    #animation = picture file
    #x = x coordinate of hit
    #y = y coordinate
    #object = may not be needed anymore
    #@b determines how quickly the animation proceeds.
    #angle, like in all other cases, is the rotation at which the image is drawn
  def initialize(animation, x, y, object)
    @animation = animation
    @x = x
    @y = y
    @index = 0
    @b = 0
    @img = @animation[@index]
    @object = object
    @angle = 0
    @color = Gosu::Color.new(255,255,100, 0)
  end
  
  def draw
    @img.draw_rot(@x , @y , ZOrder::Projectile, rand(360), 0.5, 0.5, 4.0, 4.0, @color, :additive)
  end
  
  #updates to the next tile of the explosion animation only if b % 2 == 0
  #if you dont do this, it happens too fast, change @b to change speed of explosion
  #returns false if it has used all the tiles, needs to be appropriate for any hit animation and not
  #one with 6 tiles
  def update
    if @b % 2 == 0
      @index += 1
    end
    @b += 1
    @img = @animation[@index]
    if @index == 6
      return false
    else
      return true
    end
  end
end
